import sys
import re

lines = sys.stdin.readlines()
for line in lines:
    line = re.sub('\n', '', line)
    m, n = line.split()
    s1 = int(m)
    s2 = int(n)
    lst = []
    down = pow(10, m-1)
    up = pow(10, m) -1
    for num in range(down, up):
        a = num // 100
        b = num // 10 % 10
        c = num % 10
        res = pow(a, 3) + pow(b, 3) + pow(c, 3)
        if num == res:
            lst.append(str(num))
    if lst:
        print(' '.join(lst))
    else:
        print('-1')

